# Copyright 2006-2012 Brendan Burns All Rights Reserved.

CC=g++
STATIC_LIBNMC=./libnmc.a
DYNAMIC_LIBNMC=./libnmc.so

CFLAGS=-I./ -O2 -fPIC
CXXFLAGS=-I./ -O2

OBJECTS=nmc.o nmc_low_level.o serial_util.o 
APPS=test_nmc

all: $(STATIC_LIBNMC) $(DYNAMIC_LIBNMC) $(APPS)

clean:
	rm -f $(OBJECTS) $(APPS) $(STATIC_LIBNMC) $(DYNAMIC_LIBNMC)

test_nmc: $(STATIC_LIBNMC)
	$(CC) -static -fPIC -o test_nmc test_nmc.c -L. -lnmc

$(STATIC_LIBNMC): $(OBJECTS)
	ar rcs $(STATIC_LIBNMC) $(OBJECTS)

$(DYNAMIC_LIBNMC): $(OBJECTS)
	$(CC) -shared -Wl,-soname,$(DYNAMIC_LIBNMC) -o $(DYNAMIC_LIBNMC) \
	   $(OBJECTS)	
